import Cookies from 'cookies-js'

export default {
	user: {
		auth: false
	},
	getInfo: function() {
		return {
			id: Cookies.get('id'),
			name: Cookies.get('name'),
			isTeacher: Cookies.get('isTeacher')==='true'
		};
	},

	getUserAndPsw: function() {
		if (Cookies.get('id')) {
			return {
				id: Cookies.get('id'),
				psw: Cookies.get('psw'),
				isTeacher: Cookies.get('isTeacher')==='true'
			};
		}
		return null;
	},

	logout: function() {
		Cookies.expire('name')
	}
};